package com.wenlin.myproduction.bean;

import com.wenlin.myproduction.util.Checker;

import java.util.List;

/**
 * 飞机
 */
public class Airplane {
    private List<Block> list;//第一个默认是机头
    private int direction;//方向

    public Airplane(List<Block> list, int direction) {
        this.list = list;
        this.direction = direction;
    }

    public List<Block> getList() {
        return list;
    }

    public void setList(List<Block> list) {
        this.list = list;
    }

    public int getDirection() {
        return direction;
    }

    public void setDirection(int direction) {
        this.direction = direction;
    }

    /**
     * 是否是飞机头的格子
     *
     * @param block 格子
     * @return 所求
     */
    public boolean isHead(Block block) {
        if (Checker.hasList(list)) {
            Block head = list.get(0);
            if (head.getX() == block.getX() && head.getY() == block.getY()) {
                return true;
            }
        }
        return false;
    }
}
